package com.ushine.web.component.validation.annotation;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * <p>
 * 该验证规则主要服务与数据库雪花ID
 * </p>
 *
 * @Author: 邱鹏
 * @Date 2021-01-14 16:16
 * @Version 1.0
 */
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@Min(value = 0, message = "ID不能小于0")
@Max(value = Long.MAX_VALUE, message = "ID不能大于9223372036854775807")
@Constraint(validatedBy = {})
public @interface LongId {

    String message() default "";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

}
